<?php
require_once ($_SERVER['DOCUMENT_ROOT'] . '/common/all_setup_first.php');
require_once ($_SERVER['DOCUMENT_ROOT'] . '/class/db/DB.php');
require_once ($_SERVER['DOCUMENT_ROOT'] . '/class/other/Message.php');
require_once ($_SERVER['DOCUMENT_ROOT'] . '/common/function_common.php');

if (!$is_login){
	//未登录
	exit;
}

$obj_conn = new DB();
$obj_Message = new Message();

$arr_input['baby_id'] = $login_id;
$arr_input['baby_fid'] = $_POST['baby_fid']; 
$arr_input['friend_name'] = $_POST['hid'];
$arr_input['title'] = $_POST['title'];
$arr_input['message'] = $_POST['message'];

//print_r($arr_input);

/* 收信记录 */
unset($arr_tmp_input);
$arr_tmp_input['baby_id'] = $arr_input['baby_fid'];
$arr_tmp_input['baby_fid'] = $arr_input['baby_id'];
$arr_tmp_input['friend_name'] = $arr_input['friend_name'];
$arr_tmp_input['message_type'] = 1;
$arr_tmp_input['title'] = $arr_input['title'];
$arr_tmp_input['message'] = $arr_input['message'];
$obj_Message->addMessage($obj_conn,$arr_tmp_input);

/* 发信记录 */
unset($arr_tmp_input);
$arr_tmp_input['baby_id'] = $arr_input['baby_id'];
$arr_tmp_input['baby_fid'] = $arr_input['baby_fid'];
$arr_tmp_input['friend_name'] = $arr_input['baby_name'];
$arr_tmp_input['message_type'] = 2;
$arr_tmp_input['title'] = $arr_input['title'];
$arr_tmp_input['message'] = $arr_input['message'];
$obj_Message->addMessage($obj_conn,$arr_tmp_input);
//$obj_Message->sendMessage($obj_conn,$arr_input);


?>